{include file="common/header"}
<section class="faq">
    <div class="container container-large">
        <ul class="faq-list" id="faqList"></ul>
    </div>
</section>

{include file="common/footer"}
{include file="common/js"}
<script>
    layui.use('flow',function () {
        var flow = layui.flow;

        flow.load({
            elem: '#faqList'
            ,isAuto: false
            ,end:' '
            ,done: function(page, next){
                var lis = [];
                $.post({
                    type:"POST",
                    url:"{:url('index/index/faq')}",
                    data:{page:page,limit: 4},
                    dataType:"JSON",
                    success:function (res) {
                        let html = ''

                        for (let i = 0; i < res.data.length; i++) {
                            html += '<li>'
                            html += '<a data-toggle="collapse" class="collapsed" href="#faq' + res.data[i].sort + '">'
                            html += '<div class="question">' + res.data[i].title + '</div>'
                            html += '</a>'
                            html += '<div id="faq' + res.data[i].sort + '" class="collapse" data-parent="#faqList">'
                            html += '<div class="answer">' + res.data[i].answer + '</div>'
                            html += '</div>'
                            html += '</li>'
                        }

                        lis.push(html)
                        next(lis.join(''), page < res.pages);
                    }
                })
            }
        });
    })
</script>
</body>
</html>